package com.codeforces.gym.g100142;

import java.io.File;
import java.io.FileWriter;
import java.util.Scanner;

public class A {

	static int N;
	static long num, sqr;

	public static void main(String[] args) throws Exception {
		Scanner scanner = new Scanner(new File("veryhard.in"));
		FileWriter writer = new FileWriter(new File("veryhard.out"));
		N = scanner.nextInt();
		for (int i=1;i<=N;++i) {
			num = scanner.nextLong();
			sqr = (long) Math.sqrt(num);
			if (sqr * sqr == num || (sqr - 1) * (sqr - 1) == num || (sqr + 1) * (sqr + 1) == num) {
				writer.write("1");
			}
			else {
				writer.write("0");
			}
			if (i == N) {
				writer.write("\n");
			}
			else {
				writer.write(" ");
			}
		}
		writer.close();
	}

}
